package top.boycharse.blog;

import com.fasterxml.jackson.databind.ser.Serializers;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import top.boycharse.blog.bean.Response.BaseResponse;
import top.boycharse.blog.exception.ParameterException;

import javax.servlet.http.HttpServletRequest;

/**
 * 全局补抓异常
 */
@ControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(value = ParameterException.class)
    @ResponseBody
    public BaseResponse<String> parameterExceptionHandler(HttpServletRequest request, ParameterException e) throws Exception {
        return BaseResponse.buildParamException();
    }
}
